package com.net.shop.car.manager.ui.chezhoubian;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.net.shop.car.manager.R;
import com.net.shop.car.manager.ui.FullScreenDialog;
import com.net.shop.car.manager.utils.Constants.ServiceType;

public class ChezhoubianDialog extends FullScreenDialog implements
		android.view.View.OnClickListener {
	private Dialog dialog;
	
	public ChezhoubianDialog(Context context) {
		super(context,R.style.dialog_NoTitle);
		// TODO Auto-generated constructor stub
		setCanceledOnTouchOutside(true);
		getWindow().setWindowAnimations(android.R.anim.cycle_interpolator);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_chezhoubian);
		
		initViews();
	}

	private void initViews() {
		findViewById(R.id.dialog_chezhoubian_back).setOnClickListener(this);
		findViewById(R.id.dialog_chezhoubian_baoyang).setOnClickListener(this);
		findViewById(R.id.dialog_chezhoubian_xiche).setOnClickListener(this);
		findViewById(R.id.dialog_chezhoubian_weixiu).setOnClickListener(this);
		findViewById(R.id.dialog_chezhoubian_meishi).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (dialog != null && dialog.isShowing()) {
			return;
		}
		ServiceType type = null;
		switch (v.getId()) {
		case R.id.dialog_chezhoubian_baoyang:
			type = ServiceType.upkeep;
			break;
		case R.id.dialog_chezhoubian_xiche:
			type = ServiceType.jzxc;
			break;
		case R.id.dialog_chezhoubian_weixiu:
			type = ServiceType.weixiu;
			break;
		case R.id.dialog_chezhoubian_meishi:

			break;
		case R.id.dialog_chezhoubian_back:
			dismiss();
			break;

		default:
			type = null;
			break;
		}
		if (type != null) {
			dialog = new SellerDialog(activity, type);
			dialog.show();
			dismiss();
		}
	}
}
